package com.kcht.sylyg08.dao.impl;

import com.kcht.adp.common.log.Logger;
import com.kcht.adp.common.sql.JPAConfig;
import com.kcht.sylyg08.dao.DataSourceBaseDao;
import com.kcht.sylyg08.dao.IContainerStatusTransformRecordDao;
import com.kcth.sylyg08.entity.ContainerStatusTransformRecord;

import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import java.util.List;

/**
  *
  * @Package:        com.kcht.sylyg08.dao.impl
  * @Description:     java类作用描述
  * @Author:         lenovo
  * @CreateDate:     2019/5/15 14:45
 */
@Singleton
@Startup
@JPAConfig(dynaSqlFile = "mapper/containerStatusTransformRecordQueryMapper.xml")
public class ContainerStatusTransformRecordDao extends DataSourceBaseDao<ContainerStatusTransformRecord, Long> implements IContainerStatusTransformRecordDao {
    @Inject
    private Logger log;

    @Override
    public List<ContainerStatusTransformRecord> queryByContainerId(String containerId) {
        return this.selectListByJPQL("select a from ContainerStatusTransformRecord a where a.containerId = ?", containerId);
    }

    @Override
    public void deleteByContainerId(String containerId) {
        for (ContainerStatusTransformRecord record : this.queryByContainerId(containerId)) {
            this.delete(record.getId());
        }
    }
}
